/**
 * 
 */
package com.kelaite.procurement.restful;

import java.util.List;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import ch.qos.logback.classic.Logger;

import com.kelaite.procurement.entity.TProvince;
import com.kelaite.procurement.service.ProvinceService;
import com.kelaite.procurement.utils.ConvertUtil;

@Controller
@RequestMapping("/api")
public class ProvinceRestController {
	
	private static final Logger logger = (Logger) LoggerFactory.getLogger(ConvertUtil.class);
	
	@Autowired
	private ProvinceService provinceService;
	
	@ResponseBody
	@RequestMapping(value = "/province", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<TProvince>> test() {
		List<TProvince> provinceList = provinceService.getByProperty("provinceName", "jiangxi");
		logger.debug("province size: " + provinceList.size());
		return new ResponseEntity<List<TProvince>>(provinceList, HttpStatus.OK);
	}
}
